# -*- mode: snippet -*-
# name: shiny server showNotification with update
# key: shiny.server.showNotification.update
# key: shiny_server_showNotification_update
# key: showNotification_update_shiny_server
# contributor: Shuguang Sun
# --
notify <- function(msg, id = NULL) {
  showNotification(msg, id = id, duration = NULL, closeButton = FALSE)
}

data <- reactive({
  id <- notify("Reading data...")
  on.exit(removeNotification(id), add = TRUE)
  Sys.sleep(1)

  notify("Reticulating splines...", id = id)
  Sys.sleep(1)

  notify("Herding llamas...", id = id)
  Sys.sleep(1)

  notify("Orthogonalizing matrices...", id = id)
  Sys.sleep(1)

  mtcars
})